<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="170px">
      <el-form-item label="工程名称" prop="engName">
        <el-input
          v-model="queryParams.engName"
          placeholder="请输入工程名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="工程编号" prop="engNo">
        <el-input
          v-model="queryParams.engNo"
          placeholder="请输入工程编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="档案馆代号,数字化部输入" prop="dangAnGuanNo">
        <el-input
          v-model="queryParams.dangAnGuanNo"
          placeholder="请输入档案馆代号,数字化部输入"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="移交单位" prop="yiJiaoDanWei">
        <el-input
          v-model="queryParams.yiJiaoDanWei"
          placeholder="请输入移交单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="编制单位" prop="bianZhiDanWei">
        <el-input
          v-model="queryParams.bianZhiDanWei"
          placeholder="请输入编制单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="编制开始时间" prop="bianZhiDateStart">
        <el-date-picker clearable
          v-model="queryParams.bianZhiDateStart"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择编制开始时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="编制结束时间" prop="bianZhiDateEnd">
        <el-date-picker clearable
          v-model="queryParams.bianZhiDateEnd"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择编制结束时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="工程地址" prop="EngAddress">
        <el-input
          v-model="queryParams.EngAddress"
          placeholder="请输入工程地址"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="总投资金额" prop="engCost">
        <el-input
          v-model="queryParams.engCost"
          placeholder="请输入总投资金额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="案卷数" prop="AnJuanShu">
        <el-input
          v-model="queryParams.AnJuanShu"
          placeholder="请输入案卷数"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="档案馆名称" prop="dangAnGuanName">
        <el-input
          v-model="queryParams.dangAnGuanName"
          placeholder="请输入档案馆名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="数字化单位" prop="shuZiHuaDanWei">
        <el-input
          v-model="queryParams.shuZiHuaDanWei"
          placeholder="请输入数字化单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="工程状态值" prop="status">
        <el-select v-model="queryParams.projectStatus" placeholder="请选择审核状态">
          <el-option v-for="(item, index) in statusOptions" :key="index" :label="item.label"
                     :value="item.value" :disabled="item.disabled"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="文件目录" prop="fileDirectory">
        <el-input
          v-model="queryParams.fileDirectory"
          placeholder="请输入文件目录"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="creationTime">
        <el-date-picker clearable
          v-model="queryParams.creationTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="是新档案" prop="isNewEng">
        <el-input
          v-model="queryParams.isNewEng"
          placeholder="请输入0:否   1：是"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="包含文件" prop="isHasOtherFile">
        <el-input
          v-model="queryParams.isHasOtherFile"
          placeholder="请输入0:否   1：是"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="${comment}" prop="yuLiuA">-->
<!--        <el-input-->
<!--          v-model="queryParams.yuLiuA"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->

      <el-form-item label="是否审核" prop="yuLiuB">
        <el-input
          v-model="queryParams.yuLiuB"
          placeholder="请输入0:否   1：是"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

<!--      <el-form-item label="${comment}" prop="yuLiuC">-->
<!--        <el-input-->
<!--          v-model="queryParams.yuLiuC"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="yuLiuD">-->
<!--        <el-input-->
<!--          v-model="queryParams.yuLiuD"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="yuLiuE">-->
<!--        <el-input-->
<!--          v-model="queryParams.yuLiuE"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="工程识别号" prop="engineeringIdentificationNumber">
        <el-input
          v-model="queryParams.engineeringIdentificationNumber"
          placeholder="请输入工程识别号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单位工程类型" prop="unitConstructionCategory">
        <el-input
          v-model="queryParams.unitConstructionCategory"
          placeholder="请输入单位工程类型"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="档案分类" prop="archiveClassification">
        <el-input
          v-model="queryParams.archiveClassification"
          placeholder="请输入档案分类"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="档案类属" prop="archiveCategory">
        <el-input
          v-model="queryParams.archiveCategory"
          placeholder="请输入档案类属"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="建设单位" prop="buildingUnit">
        <el-input
          v-model="queryParams.buildingUnit"
          placeholder="请输入建设单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="立项批准单位" prop="projectApprovalUnit">
        <el-input
          v-model="queryParams.projectApprovalUnit"
          placeholder="请输入立项批准单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="立项批准文号" prop="projectApprovalNumber">
        <el-input
          v-model="queryParams.projectApprovalNumber"
          placeholder="请输入立项批准文号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="规划许可证号" prop="planningPermitNumber">
        <el-input
          v-model="queryParams.planningPermitNumber"
          placeholder="请输入规划许可证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="用地规划许可证号" prop="landPlanningPermitNumber">
        <el-input
          v-model="queryParams.landPlanningPermitNumber"
          placeholder="请输入用地规划许可证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="用地许可证号" prop="landUsePermitNumber">
        <el-input
          v-model="queryParams.landUsePermitNumber"
          placeholder="请输入用地许可证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="施工许可证号" prop="constructionPermitNumber">
        <el-input
          v-model="queryParams.constructionPermitNumber"
          placeholder="请输入施工许可证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="总长度" prop="totalLength">
        <el-input
          v-model="queryParams.totalLength"
          placeholder="请输入总长度"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="案卷页数" prop="archivePageNumber">
        <el-input
          v-model="queryParams.archivePageNumber"
          placeholder="请输入案卷页数"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="开工日期" prop="startDate">
        <el-date-picker clearable
          v-model="queryParams.startDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择开工日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="竣工日期" prop="completionDate">
        <el-date-picker clearable
          v-model="queryParams.completionDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择竣工日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="起点" prop="startPoint">
        <el-input
          v-model="queryParams.startPoint"
          placeholder="请输入起点"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="止点" prop="endPoint">
        <el-input
          v-model="queryParams.endPoint"
          placeholder="请输入止点"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="勘察单位" prop="explorationUnit">
        <el-input
          v-model="queryParams.explorationUnit"
          placeholder="请输入勘察单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="勘察项目负责人" prop="explorationProjectLeader">
        <el-input
          v-model="queryParams.explorationProjectLeader"
          placeholder="请输入勘察项目负责人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="设计单位" prop="designUnit">
        <el-input
          v-model="queryParams.designUnit"
          placeholder="请输入设计单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="设计项目负责人" prop="designProjectLeader">
        <el-input
          v-model="queryParams.designProjectLeader"
          placeholder="请输入设计项目负责人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="注册表id" prop="register">
        <el-input
          v-model="queryParams.register"
          placeholder="请输入注册表id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:eng:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:eng:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:eng:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:eng:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="engList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="编号" align="center" prop="id" />
      <el-table-column label="工程名称" align="center" prop="engName" />
      <el-table-column label="工程编号" align="center" prop="engNo" />
      <el-table-column label="档案馆代号" align="center" prop="dangAnGuanNo" />
      <el-table-column label="移交单位" align="center" prop="yiJiaoDanWei" />
      <el-table-column label="编制单位" align="center" prop="bianZhiDanWei" />
      <el-table-column label="编制开始时间" align="center" prop="bianZhiDateStart" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.bianZhiDateStart, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="编制结束时间" align="center" prop="bianZhiDateEnd" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.bianZhiDateEnd, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="工程地址" align="center" prop="EngAddress" />
      <el-table-column label="总投资金额" align="center" prop="engCost" />
      <el-table-column label="案卷数" align="center" prop="AnJuanShu" />
      <el-table-column label="档案馆名称" align="center" prop="dangAnGuanName" />
      <el-table-column label="数字化单位" align="center" prop="shuZiHuaDanWei" />
      <el-table-column label="工程状态值程" align="center" prop="projectStatus" />
      <el-table-column label="文件目录" align="center" prop="fileDirectory" />
      <el-table-column label="创建时间" align="center" prop="creationTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.creationTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="0:否   1：是" align="center" prop="isNewEng" />
      <el-table-column label="0:否  1：是" align="center" prop="isHasOtherFile" />
      <!--      <el-table-column label="${comment}" align="center" prop="yuLiuA" />-->
      <el-table-column label="是否审核" align="center" prop="yuLiuB" />
      <!--      <el-table-column label="${comment}" align="center" prop="yuLiuC" />-->
      <!--      <el-table-column label="${comment}" align="center" prop="yuLiuD" />-->
      <!--      <el-table-column label="${comment}" align="center" prop="yuLiuE" />-->
      <el-table-column label="工程识别号" align="center" prop="engineeringIdentificationNumber" />
      <el-table-column label="单位工程类型" align="center" prop="unitConstructionCategory" />
      <el-table-column label="档案分类" align="center" prop="archiveClassification" />
      <el-table-column label="档案类属" align="center" prop="archiveCategory" />
      <el-table-column label="建设单位" align="center" prop="buildingUnit" />
      <el-table-column label="立项批准单位" align="center" prop="projectApprovalUnit" />
      <el-table-column label="立项批准文号" align="center" prop="projectApprovalNumber" />
      <el-table-column label="规划许可证号" align="center" prop="planningPermitNumber" />
      <el-table-column label="用地规划许可证号" align="center" prop="landPlanningPermitNumber" />
      <el-table-column label="用地许可证号" align="center" prop="landUsePermitNumber" />
      <el-table-column label="施工许可证号" align="center" prop="constructionPermitNumber" />
      <el-table-column label="总长度" align="center" prop="totalLength" />
      <el-table-column label="案卷页数" align="center" prop="archivePageNumber" />
      <el-table-column label="开工日期" align="center" prop="startDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="竣工日期" align="center" prop="completionDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.completionDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="起点" align="center" prop="startPoint" />
      <el-table-column label="止点" align="center" prop="endPoint" />
      <el-table-column label="勘察单位" align="center" prop="explorationUnit" />
      <el-table-column label="勘察项目负责人" align="center" prop="explorationProjectLeader" />
      <el-table-column label="设计单位" align="center" prop="designUnit" />
      <el-table-column label="设计项目负责人" align="center" prop="designProjectLeader" />
      <el-table-column label="注册表id" align="center" prop="register" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:eng:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:eng:remove']"register_id`
          >删除</el-button>
          <el-button
            size="small"
            @click="openAddVolumeDialog(scope.row)">
            新增案卷</el-button>

        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改【请填写功能名称】对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="工程名称" prop="engName">
          <el-input v-model="form.engName" placeholder="请输入工程名称" />
        </el-form-item>
        <el-form-item label="工程编号" prop="engNo">
          <el-input v-model="form.engNo" placeholder="请输入工程编号,数字化部输入,电子档案接收室提供格式：2016-

108" />
        </el-form-item>
        <el-form-item label="档案馆代号" prop="dangAnGuanNo">
          <el-input v-model="form.dangAnGuanNo" placeholder="请输入档案馆代号,数字化部输入" />
        </el-form-item>
        <el-form-item label="移交单位" prop="yiJiaoDanWei">
          <el-input v-model="form.yiJiaoDanWei" placeholder="请输入移交单位" />
        </el-form-item>
        <el-form-item label="编制单位" prop="bianZhiDanWei">
          <el-input v-model="form.bianZhiDanWei" placeholder="请输入编制单位" />
        </el-form-item>
        <el-form-item label="编制开始时间" prop="bianZhiDateStart">
          <el-date-picker clearable
            v-model="form.bianZhiDateStart"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择编制开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="编制结束时间" prop="bianZhiDateEnd">
          <el-date-picker clearable
            v-model="form.bianZhiDateEnd"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择编制结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="工程地址" prop="EngAddress">
          <el-input v-model="form.EngAddress" placeholder="请输入工程地址" />
        </el-form-item>
        <el-form-item label="总投资金额" prop="engCost">
          <el-input v-model="form.engCost" placeholder="请输入总投资金额" />
        </el-form-item>
        <el-form-item label="案卷数" prop="AnJuanShu">
          <el-input v-model="form.AnJuanShu" placeholder="请输入案卷数" />
        </el-form-item>
        <el-form-item label="档案馆名称" prop="dangAnGuanName">
          <el-input v-model="form.dangAnGuanName" placeholder="请输入档案馆名称" />
        </el-form-item>
        <el-form-item label="数字化单位" prop="shuZiHuaDanWei">
          <el-input v-model="form.shuZiHuaDanWei" placeholder="请输入数字化单位" />
        </el-form-item>
        <el-form-item label="工程状态值" prop="status">
          <el-select v-model="form.projectStatus" placeholder="请选择审核状态">
            <el-option v-for="(item, index) in statusOptions" :key="index" :label="item.label"
                       :value="item.value" :disabled="item.disabled"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="文件目录" prop="fileDirectory">
          <el-input v-model="form.fileDirectory" placeholder="请输入文件目录，文件存入服务器自动生成" />
        </el-form-item>
        <el-form-item label="创建时间" prop="creationTime">
          <el-date-picker clearable
            v-model="form.creationTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择创建时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="是新文档" prop="isNewEng">
          <el-input v-model="form.isNewEng" placeholder="请输入0:否   1：是" />
        </el-form-item>
        <el-form-item label="是否有其它文件" prop="isHasOtherFile">
          <el-input v-model="form.isHasOtherFile" placeholder="请输入0:否   1：是" />
        </el-form-item>
        <!--        <el-form-item label="${comment}" prop="yuLiuA">-->
        <!--          <el-input v-model="form.yuLiuA" placeholder="请输入${comment}" />-->
        <!--        </el-form-item>-->
        <el-form-item label="是否审核" prop="yuLiuB">
          <el-input v-model="form.yuLiuB" placeholder="请输入" />
        </el-form-item>
        <!--        <el-form-item label="${comment}" prop="yuLiuC">-->
        <!--          <el-input v-model="form.yuLiuC" placeholder="请输入${comment}" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="${comment}" prop="yuLiuD">-->
        <!--          <el-input v-model="form.yuLiuD" placeholder="请输入${comment}" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="${comment}" prop="yuLiuE">-->
        <!--          <el-input v-model="form.yuLiuE" placeholder="请输入${comment}" />-->
        <!--        </el-form-item>-->
        <el-form-item label="工程识别号" prop="engineeringIdentificationNumber">
          <el-input v-model="form.engineeringIdentificationNumber" placeholder="请输入工程识别号" />
        </el-form-item>
        <el-form-item label="单位工程类型" prop="unitConstructionCategory">
          <el-input v-model="form.unitConstructionCategory" placeholder="请输入单位工程类型" />
        </el-form-item>
        <el-form-item label="档案分类" prop="archiveClassification">
          <el-input v-model="form.archiveClassification" placeholder="请输入档案分类" />
        </el-form-item>
        <el-form-item label="档案类属" prop="archiveCategory">
          <el-input v-model="form.archiveCategory" placeholder="请输入档案类属" />
        </el-form-item>
        <el-form-item label="建设单位" prop="buildingUnit">
          <el-input v-model="form.buildingUnit" placeholder="请输入建设单位" />
        </el-form-item>
        <el-form-item label="立项批准单位" prop="projectApprovalUnit">
          <el-input v-model="form.projectApprovalUnit" placeholder="请输入立项批准单位" />
        </el-form-item>
        <el-form-item label="立项批准文号" prop="projectApprovalNumber">
          <el-input v-model="form.projectApprovalNumber" placeholder="请输入立项批准文号" />
        </el-form-item>
        <el-form-item label="规划许可证号" prop="planningPermitNumber">
          <el-input v-model="form.planningPermitNumber" placeholder="请输入规划许可证号" />
        </el-form-item>
        <el-form-item label="用地规划许可证号" prop="landPlanningPermitNumber">
          <el-input v-model="form.landPlanningPermitNumber" placeholder="请输入用地规划许可证号" />
        </el-form-item>
        <el-form-item label="用地许可证号" prop="landUsePermitNumber">
          <el-input v-model="form.landUsePermitNumber" placeholder="请输入用地许可证号" />
        </el-form-item>
        <el-form-item label="施工许可证号" prop="constructionPermitNumber">
          <el-input v-model="form.constructionPermitNumber" placeholder="请输入施工许可证号" />
        </el-form-item>
        <el-form-item label="总长度" prop="totalLength">
          <el-input v-model="form.totalLength" placeholder="请输入总长度" />
        </el-form-item>
        <el-form-item label="案卷页数" prop="archivePageNumber">
          <el-input v-model="form.archivePageNumber" placeholder="请输入案卷页数" />
        </el-form-item>
        <el-form-item label="开工日期" prop="startDate">
          <el-date-picker clearable
            v-model="form.startDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择开工日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="竣工日期" prop="completionDate">
          <el-date-picker clearable
            v-model="form.completionDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择竣工日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="起点" prop="startPoint">
          <el-input v-model="form.startPoint" placeholder="请输入起点" />
        </el-form-item>
        <el-form-item label="止点" prop="endPoint">
          <el-input v-model="form.endPoint" placeholder="请输入止点" />
        </el-form-item>
        <el-form-item label="勘察单位" prop="explorationUnit">
          <el-input v-model="form.explorationUnit" placeholder="请输入勘察单位" />
        </el-form-item>
        <el-form-item label="勘察项目负责人" prop="explorationProjectLeader">
          <el-input v-model="form.explorationProjectLeader" placeholder="请输入勘察项目负责人" />
        </el-form-item>
        <el-form-item label="设计单位" prop="designUnit">
          <el-input v-model="form.designUnit" placeholder="请输入设计单位" />
        </el-form-item>
        <el-form-item label="设计项目负责人" prop="designProjectLeader">
          <el-input v-model="form.designProjectLeader" placeholder="请输入设计项目负责人" />
        </el-form-item>
        <el-form-item label="注册表id" prop="register">
          <el-input v-model="form.register" placeholder="请输入注册表id" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 工程后添加案卷按钮对话框 -->
    <el-dialog :visible.sync="addVolumeDialogVisible" title="新增案卷">
      <el-form :model="newVolumeForm" ref="newVolumeFormRef" :rules="rules" label-width="80px">
        <el-form-item label="案卷名" prop="anJuanName">
          <el-input v-model="newVolumeForm.anJuanName" placeholder="请输入案卷名，数字化部输入" />
        </el-form-item>
        <el-form-item label="文件目录" prop="fileDirectory">
          <el-input v-model="newVolumeForm.fileDirectory" placeholder="请输入文件目录，文件存入服务器自动生成" />
        </el-form-item>
        <el-form-item label="创建时间" prop="creationTime">
          <el-date-picker clearable
                          v-model="newVolumeForm.creationTime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择创建时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="盒号" prop="henum">
          <el-input v-model="newVolumeForm.henum" placeholder="请输入盒号" />
        </el-form-item>
        <el-form-item label="文件题名" prop="tname">
          <el-input v-model="newVolumeForm.tname" placeholder="请输入文件题名" />
        </el-form-item>
        <el-form-item label="编制单位" prop="buildorganization">
          <el-input v-model="newVolumeForm.buildorganization" placeholder="请输入编制单位" />
        </el-form-item>
        <el-form-item label="数量/单位" prop="amount">
          <el-input v-model="newVolumeForm.amount" placeholder="请输入数量/单位" />
        </el-form-item>
        <el-form-item label="纸张规格" prop="spec">
          <el-input v-model="newVolumeForm.spec" placeholder="请输入纸张规格" />
        </el-form-item>
        <el-form-item label="文件开始时间" prop="filestart">
          <el-date-picker clearable
                          v-model="newVolumeForm.filestart"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择文件开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间" prop="fileend">
          <el-date-picker clearable
                          v-model="newVolumeForm.fileend"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="保存期限" prop="savetime">
          <el-input v-model="newVolumeForm.savetime" placeholder="请输入保存期限" />
        </el-form-item>
        <el-form-item label="级别" prop="securitylayer">
          <el-input v-model="newVolumeForm.securitylayer" placeholder="请输入级别" />
        </el-form-item>
        <el-form-item label="主题词" prop="thematic">
          <el-input v-model="newVolumeForm.thematic" placeholder="请输入主题词" />
        </el-form-item>
        <el-form-item label="附注" prop="annotations">
          <el-input v-model="newVolumeForm.annotations" placeholder="请输入附注" />
        </el-form-item>
        <el-form-item label="文件总数" prop="totalfile">
          <file-upload v-model="newVolumeForm.totalfile"/>
        </el-form-item>
        <el-form-item label="总页数" prop="totalpage">
          <el-input v-model="newVolumeForm.totalpage" placeholder="请输入总页数" />
        </el-form-item>
        <el-form-item label="文字页数" prop="txtpage">
          <el-input v-model="newVolumeForm.txtpage" placeholder="请输入文字页数" />
        </el-form-item>
        <el-form-item label="创建人" prop="cmen">
          <el-input v-model="newVolumeForm.cmen" placeholder="请输入创建人" />
        </el-form-item>
        <el-form-item label="创建时间" prop="ctime">
          <el-date-picker clearable
                          v-model="newVolumeForm.ctime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择创建时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="校对人" prop="assessor">
          <el-input v-model="newVolumeForm.assessor" placeholder="请输入校对人" />
        </el-form-item>
        <el-form-item label="校对时间" prop="atime">
          <el-date-picker clearable
                          v-model="newVolumeForm.atime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择校对时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="案卷分类" prop="topnode">
          <el-input v-model="newVolumeForm.topnode" placeholder="请输入案卷分类" />
        </el-form-item>
        <el-form-item label="立卷人" prop="injectionperson">
          <el-input v-model="newVolumeForm.injectionperson" placeholder="请输入立卷人" />
        </el-form-item>
        <el-form-item label="立卷时间" prop="injectiondate">
          <el-date-picker clearable
                          v-model="newVolumeForm.injectiondate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择立卷时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="审核人" prop="checkperson">
          <el-input v-model="newVolumeForm.checkperson" placeholder="请输入审核人" />
        </el-form-item>
        <el-form-item label="审核时间" prop="checkdate">
          <el-date-picker clearable
                          v-model="newVolumeForm.checkdate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择审核时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="工程id" prop="regprojid">
          <el-input v-model="newVolumeForm.regprojid" placeholder="请输入工程id" />
        </el-form-item>
        <el-form-item label="电子档案保存路径" prop="path">
          <el-input v-model="newVolumeForm.path" placeholder="请输入电子档案保存路径" />
        </el-form-item>
        <el-form-item label="实体档案存放位置" prop="storeposition">
          <el-input v-model="newVolumeForm.storeposition" placeholder="请输入实体档案存放位置" />
        </el-form-item>
        <el-form-item label="预留字段1" prop="volumeYuliu1">
          <el-input v-model="newVolumeForm.volumeYuliu1" placeholder="请输入预留字段1" />
        </el-form-item>
        <el-form-item label="预留字段2" prop="volumeYuliu2">
          <el-input v-model="newVolumeForm.volumeYuliu2" placeholder="请输入预留字段2" />
        </el-form-item>
        <el-form-item label="预留字段3" prop="volumeYuliu3">
          <el-input v-model="newVolumeForm.volumeYuliu3" placeholder="请输入预留字段3" />
        </el-form-item>
        <el-form-item label="预留字段4" prop="volumeYuliu4">
          <el-input v-model="newVolumeForm.volumeYuliu4" placeholder="请输入预留字段4" />
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="addVolumeDialogVisible = false">取消</el-button>
        <el-button type="primary" @click="submitNewVolume">提交</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
import { listEng, getEng, delEng, addEng, updateEng } from "@/api/system/eng";
import { v4 as uuidv4 } from 'uuid'
import {addAnjuan} from "@/api/system/anjuan";

export default {
  name: "Eng",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 【请填写功能名称】表格数据
      engList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        engName: null,
        engNo: null,
        dangAnGuanNo: null,
        yiJiaoDanWei: null,
        bianZhiDanWei: null,
        bianZhiDateStart: null,
        bianZhiDateEnd: null,
        EngAddress: null,
        engCost: null,
        AnJuanShu: null,
        dangAnGuanName: null,
        shuZiHuaDanWei: null,
        projectStatus: null,
        fileDirectory: null,
        creationTime: null,
        isNewEng: null,
        isHasOtherFile: null,
        yuLiuA: null,
        yuLiuB: null,
        yuLiuC: null,
        yuLiuD: null,
        yuLiuE: null,
        engineeringIdentificationNumber: null,
        unitConstructionCategory: null,
        archiveClassification: null,
        archiveCategory: null,
        buildingUnit: null,
        projectApprovalUnit: null,
        projectApprovalNumber: null,
        planningPermitNumber: null,
        landPlanningPermitNumber: null,
        landUsePermitNumber: null,
        constructionPermitNumber: null,
        totalLength: null,
        archivePageNumber: null,
        startDate: null,
        completionDate: null,
        startPoint: null,
        endPoint: null,
        explorationUnit: null,
        explorationProjectLeader: null,
        designUnit: null,
        designProjectLeader: null,
        register: null,
      },


      // 工程后面添加案卷按钮用
      newVolumeForm: {
        eeid: null,
        anJuanName: '',
        fileDirectory: '',
        creationTime: '',
        henum: '',
        tname: '',
        buildorganization: '',
        amount: '',
        spec: '',
        filestart: '',
        fileend: '',
        savetime: '',
        securitylayer: '',
        thematic: '',
        annotations: '',
        totalfile: null, // Assuming file-upload component will handle the initial value
        totalpage: '',
        txtpage: '',
        cmen: '',
        ctime: '',
        assessor: '',
        atime: '',
        topnode: '',
        injectionperson: '',
        injectiondate: '',
        checkperson: '',
        checkdate: '',
        regprojid: '',
        path: '',
        storeposition: '',
        volumeYuliu1: '',
        volumeYuliu2: '',
        volumeYuliu3: '',
        volumeYuliu4: ''
      },
      addVolumeDialogVisible: false, // 控制模态窗口的显示


      statusOptions: [{
        "label": "未检测",
        "value": 0
      }, {
        "label": "检测通过",
        "value": 1
      }, {
        "label": "已进入流程",
        "value": 2
      },{
        "label": "分卷中",
        "value": 3
      },{
        "label": "已归档",
        "value": 4
      }],
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        engineeringIdentificationNumber: [
          { required: true, message: "工程识别号不能为空", trigger: "blur" }
        ],
        unitConstructionCategory: [
          { required: true, message: "单位工程类型不能为空", trigger: "blur" }
        ],
        archiveCategory: [
          { required: true, message: "档案类属不能为空", trigger: "blur" }
        ],
        startDate: [
          { required: true, message: "开工日期不能为空", trigger: "blur" }
        ],
        explorationUnit: [
          { required: true, message: "勘察单位不能为空", trigger: "blur" }
        ],
        designUnit: [
          { required: true, message: "设计单位不能为空", trigger: "blur" }
        ],
        register: [
          { required: true, message: "注册表不能为空", trigger: "blur" }
        ],
        isNewEng:[
          { pattern: /^[0|1]$/, message: "必须为0或1", trigger: "blur" }
        ],
        isHasOtherFile:[
          { pattern: /^[0|1]$/, message: "必须为0或1", trigger: "blur" }
        ]
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询【请填写功能名称】列表 */
    getList() {
      this.loading = true;
      listEng(this.queryParams).then(response => {
        this.engList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        engName: null,
        engNo: null,
        dangAnGuanNo: null,
        yiJiaoDanWei: null,
        bianZhiDanWei: null,
        bianZhiDateStart: null,
        bianZhiDateEnd: null,
        EngAddress: null,
        engCost: null,
        AnJuanShu: null,
        dangAnGuanName: null,
        shuZiHuaDanWei: null,
        projectStatus: null,
        fileDirectory: null,
        creationTime: null,
        isNewEng: null,
        isHasOtherFile: null,
        yuLiuA: null,
        yuLiuB: null,
        yuLiuC: null,
        yuLiuD: null,
        yuLiuE: null,
        engineeringIdentificationNumber: null,
        unitConstructionCategory: null,
        archiveClassification: null,
        archiveCategory: null,
        buildingUnit: null,
        projectApprovalUnit: null,
        projectApprovalNumber: null,
        planningPermitNumber: null,
        landPlanningPermitNumber: null,
        landUsePermitNumber: null,
        constructionPermitNumber: null,
        totalLength: null,
        archivePageNumber: null,
        startDate: null,
        completionDate: null,
        startPoint: null,
        endPoint: null,
        explorationUnit: null,
        explorationProjectLeader: null,
        designUnit: null,
        designProjectLeader: null,
        register: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加【请填写功能名称】";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getEng(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改【请填写功能名称】";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateEng(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            this.form.id=uuidv4();
            addEng(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项？').then(function() {
        return delEng(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },

    /** 新增案卷操作 */
    handleAddVolume(row) {

      this.currentEeid = row.eeid; // 保存当前工程ID
      his.openAddVolumeModal = true; // 控制模态窗口打开的变量

    },
    openAddVolumeDialog(row) {
      this.newVolumeForm.eeid = row.id; // 设置工程ID
      this.addVolumeDialogVisible = true;
    },
    submitNewVolume() {
      this.newVolumeForm.id = uuidv4();
      addAnjuan(this.newVolumeForm).then(() => {
        this.$message.success('案卷添加成功');
        this.addVolumeDialogVisible = false;
        // 可能需要更新案卷列表
      }).catch(error => {
        this.$message.error('添加失败: ' + error.message);
      });
    },

    /** 导出按钮操作 */
    handleExport() {
      this.download('system/eng/export', {
        ...this.queryParams
      }, `eng_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
